package com.choosefine.base.shixiaobao.device.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.choosefine.base.shixiaobao.base.BaseService;
import com.choosefine.base.shixiaobao.common.def.CommonConstant;
import com.choosefine.base.shixiaobao.device.dao.LedInfoMapper;
import com.choosefine.base.shixiaobao.device.model.LedInfo;


@Service("LedInfoService")
public class LedInfoService extends BaseService {
	@Autowired
	LedInfoMapper ledInfoMapper;
	
	public LedInfo getLedInfoById(Integer id) throws Exception {
		return ledInfoMapper.selectByPrimaryKey(id);
	}
	
	public Integer save(LedInfo ledInfo) throws Exception {
		return ledInfoMapper.insert(ledInfo);
	}
	
	public Integer update(LedInfo ledInfo) throws Exception {
		return ledInfoMapper.updateByPrimaryKeySelective(ledInfo);
	}
	
	/*
	 * @category 逻辑删除
	 */
	public Integer delete(Integer id) throws Exception {
		LedInfo info = new LedInfo();
		info.setId(id);
		info.setIsValid(CommonConstant.INVALID);
		return ledInfoMapper.updateByPrimaryKeySelective(info);
	}
}
